import { createStore, combineReducers, applyMiddleware } from 'redux';
import languageReducer from "./language/languageReducer";
import recommendProductsReducer from "./recommendProducts/recommendProductsReducer";
import { productSearchSlice } from "./productSearch/slice"
import thunk from "redux-thunk";
import { actionLog } from "./middlewares/actionLog";
import { configureStore } from '@reduxjs/toolkit';

const rootReducer = combineReducers({
    language: languageReducer,
    recommendProducts: recommendProductsReducer,
    productSearch:productSearchSlice.reducer

})

const store = configureStore({
    reducer:rootReducer,
    middleware:(getDefaultMiddleware)=>([...getDefaultMiddleware(),actionLog]),
    devTools:true,
})
// const store = createStore(rootReducer, applyMiddleware(thunk, actionLog));

export type RootState = ReturnType<typeof store.getState>

export default store;